﻿//using System;
//using System.Windows.Controls;
//using Granite.Xaml;
//using System.Windows.Input;
//using System.Diagnostics;
//using System.Windows.Navigation;

//namespace Granite.Xaml
//{

//	public class NavigationServiceNavigator : INavigator
//	{
//		readonly NavigationService m_NavigatorService;

//		public NavigationServiceNavigator(NavigationService navigator)
//		{
//			m_NavigatorService = navigator;
//		}

//		/// <summary>
//		/// Navigate to the indicated URI
//		/// </summary>
//		/// <param name="target"></param>
//		public void Navigate(Uri target)
//		{
//			NavigatorService.Navigate(target);

//		}

//		/// <summary>
//		/// Indicates that GoBack can be safely called.
//		/// </summary>
//		public bool CanGoBack
//		{
//			get { return NavigatorService.CanGoBack; }
//		}

//		/// <summary>
//		/// Indicates that GoForward can be safely called.
//		/// </summary>
//		public bool CanGoForward
//		{
//			get { return NavigatorService.CanGoForward; }
//		}

//		/// <summary>
//		/// Return to the previous View in the navigation journal.
//		/// </summary>
//		public void GoBack()
//		{
//			NavigatorService.GoBack();
//		}

//		/// <summary>
//		/// Go to the next view in the navigation journal.
//		/// </summary>
//		public void GoForward()
//		{
//			NavigatorService.GoForward();
//		}

//		/// <summary>
//		/// Access the underlying NavigatorService for this Navigator
//		/// </summary>
//		public NavigationService NavigatorService
//		{
//			get { return m_NavigatorService; }
//		}
//	}

//	/// <summary>
//	/// This is an abstraction over the basic navigation features in WPF, Silverlight, etc.
//	/// </summary>
//	public interface INavigator
//	{
//		/// <summary>
//		/// Navigate to the indicated URI
//		/// </summary>
//		/// <param name="target"></param>
//		void Navigate(Uri target);

//		/// <summary>
//		/// Indicates that GoBack can be safely called.
//		/// </summary>
//		bool CanGoBack { get; }

//		/// <summary>
//		/// Indicates that GoForward can be safely called.
//		/// </summary>
//		bool CanGoForward { get; }

//		/// <summary>
//		/// Return to the previous View in the navigation journal.
//		/// </summary>
//		void GoBack();

//		/// <summary>
//		/// Go to the next view in the navigation journal.
//		/// </summary>
//		void GoForward();
//	}


//	public class NavigationViewModel : ViewModelBase
//	{
//		readonly INavigator m_Navigator;

//		/// <summary>
//		/// Initializes a new instance of the NavigationViewModel class.
//		/// </summary>
//		public NavigationViewModel(NavigationService navigator)
//		{
//			m_Navigator = new NavigationServiceNavigator(navigator);
//		}

//		/// <summary>
//		/// Initializes a new instance of the NavigationViewModel class.
//		/// </summary>
//		public NavigationViewModel(NavigationWindow navigator)
//		{
//			m_Navigator = new NavigationServiceNavigator(navigator.NavigationService);
//		}

//		/// <summary>
//		/// Initializes a new instance of the NavigationViewModel class.
//		/// </summary>
//		public NavigationViewModel(Frame navigator)
//		{
//			m_Navigator = new NavigationServiceNavigator(navigator.NavigationService);
//		}

//		/// <summary>
//		/// Navigate to the indicated view. The view name will be translated into a URI using the NavigationFormatString.
//		/// </summary>
//		/// <param name="viewName"></param>
//		protected void Navigate(string viewName)
//		{
//			Navigator.Navigate(new Uri(String.Format(NavigationFormatString, viewName), UriKind.Relative));
//		}

//		/// <summary>
//		/// This is the format string used to map views to a XAML URI.
//		/// </summary>
//		public string NavigationFormatString
//		{
//			get { return Get<string>(@"/Views/{0}.xaml", "NavigationFormatString"); }
//			set { Set(value, "NavigationFormatString"); }
//		}

//		/// <summary>
//		/// Opens the indicated website in an external window.
//		/// </summary>
//		/// <param name="url"></param>
//		public void OpenExternalWebsite(string url)
//		{
//			try
//			{
//				Mouse.OverrideCursor = Cursors.AppStarting;
//				Process.Start(url);
//			}
//			catch
//			{
//			}
//			finally
//			{
//				Mouse.OverrideCursor = null;
//			}

//		}

//		/// <summary>
//		/// Opens the indicated website in an external window.
//		/// </summary>
//		/// <param name="url"></param>
//		public void OpenExternalWebsite(Uri url)
//		{
//			OpenExternalWebsite(url.ToString());
//		}

//		/// <summary>
//		/// This provides access to basic navigation functions. Platform specific navigation functions are not exposed by this interface, but they may be exposed by the concrete type.
//		/// </summary>
//		protected INavigator Navigator
//		{
//			get { return m_Navigator; }
//		}

//		/// <summary>
//		/// The commandParameter associated with this command is used as the target view name
//		/// </summary>
//		public ICommand NavigateCommand
//		{
//			get { return GetCommand<string>(viewName => Navigate(viewName), "NavigateCommand"); }
//		}
//	}
//}
